define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'dpjz.room/index',
        add_url: 'dpjz.room/add',
        edit_url: 'dpjz.room/edit',
        delete_url: 'dpjz.room/delete',
        export_url: 'dpjz.room/export',
        modify_url: 'dpjz.room/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:['refresh', 'delete'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'dpjzUser.nickname', title: '房主',templet:function(d){
                    	if(d.dpjzUser == undefined || d.dpjzUser.avatar == undefined || d.dpjzUser.avatar == ''){
                    		return "无";
                    	}else{
                    		return "<img style='max-width:25px;' src='"+d.dpjzUser.avatar+"'></img>"+d.dpjzUser.nickname;
                    	}
                    }},                    {field: 'code', title: '房号'},                    {field: 'charge', title: '桌位费'},                    {field: 'is_status', search: 'select', selectList: ["进行中","已结束","已结算"], title: '状态'},                    {field: 'create_time', title: '创建时间'},                    {width: 250, title: '操作', templet: "#test-table-operate-barDemo"},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});